﻿namespace Vkontakte.Api.Operations
{
	[ApiMethod("activity.getHistory")]
	public sealed class ActivityGetHistory
		: Base30ApiOperation
	{
		private ActivityHistoryItem[] _items;

		public ActivityGetHistory()
		{

		}

		protected override void Compile()
		{
			AddParameter("method", "activity.getHistory");
			if (UserID != null)
			{
				AddParameter("uid", UserID.Value.ToString());
			}

			base.Compile();
		}

		protected override void ParseData(string data)
		{
			ListingResponce responce = Serializer.LoadObjectXmlString<ListingResponce>(data);
			_items = responce.Activities;
			base.ParseData(data);
		}

		public long? UserID { get; set; }

		public ActivityHistoryItem[] GetResult()
		{
			return _items;
		}
	}
}